from .manager import FilterManager


class FilterBase(FilterManager, alias="base"):
    """
    所有Filter类的基类
    """

    name = "default"

    @classmethod
    def __hash__(cls):
        return sum(map(ord, TagManager._get_tag_term(cls)))

    @classmethod
    def render(cls, expr, context, transformer=None):
        raise NotImplementedError


if __name__ == "__main__":
    print(FilterManager.__registry__)
    print(FilterManager.__registry__.default)
    print(FilterManager.__registry__.ddd)
    print(FilterManager.__registry__.alias)
    print(FilterManager.get_filter("default"))
    print(FilterManager.get_filter("ddd"))
    print(FilterManager.get_filter("alias"))
